﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ServiceAssignerServiceSelectorSecond.aspx.vb" Inherits="ccapps.ServiceAssignerServiceSelectorSecond" %>

<%@ Register TagPrefix="cc2" Namespace="Library.WebControls" Assembly="lib" %>
<%@ Register TagPrefix="cc1" Namespace="ccapps.BillingNetControlLibrary" Assembly="ccapps" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>LA_GenerateStep1</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</head>
<body>
    <form id="Form1" method="post" runat="server">
        <table id="Table2" style="BORDER-COLLAPSE: collapse" cellpadding="3" width="100%" border="0">
            <tr>
                <td class="prompt" colspan="2">
                    <asp:Label ID="lblContextHeaderSecond" runat="server"> Üzerinde 
      Assignment yapacağınız servisleri seçin, işlem türünü seçin, gerekli parametreleri 
      belirtin, ve Devam butonunu tıklayın.</asp:Label></td>
            </tr>
            <tr>
                <td class="solbaslik" style="HEIGHT: 25px" width="120">İşlem Türü</td>
                <td class="input" style="HEIGHT: 25px">
                    <asp:Label ID="lblProcessTypeSecond" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td class="solbaslik" width="120">Request Numarası</td>
                <td class="input">
                    <asp:Label ID="lblProcessIDSecond" runat="server"></asp:Label></td>
            </tr>
        </table>
        <br>
        <asp:Label ID="LblokSecond" runat="server" Width="608px" Height="14px" Font-Names="Tahoma" Font-Bold="True"
            ForeColor="#C00000" Font-Size="10pt"></asp:Label><br>
        <br>
        <asp:DataGrid ID="DataGrid1Second" runat="server" Width="100%" AutoGenerateColumns="False" AllowPaging="true" PageSize="3000">
            <FooterStyle Font-Size="11px" Font-Names="Arial" ForeColor="White" BackColor="#A2547F"></FooterStyle>
            <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#A2547F"></HeaderStyle>
            <Columns>
                <asp:TemplateColumn HeaderText="Servis">
                    <HeaderStyle Font-Size="11px" Font-Names="Arial" ForeColor="White" Width="10px"></HeaderStyle>
                    <ItemStyle Font-Size="11px" Font-Names="Arial" Wrap="False" BackColor="Lavender" Width="1000"></ItemStyle>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkSelect" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Text") %>' ToolTip='<%# DataBinder.Eval(Container.DataItem, "Value") %>'></asp:CheckBox>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="İşlem">
                    <HeaderStyle Font-Size="11px" Font-Names="Arial" ForeColor="White" Width="10px"></HeaderStyle>
                    <ItemStyle Font-Size="11px" Font-Names="Arial" Wrap="False" BackColor="Lavender" Width="200"></ItemStyle>
                    <ItemTemplate>
                        <asp:RadioButtonList ID="rlstProcessType" runat="server" SelectedValue="<%# DefaultProcessType %>" RepeatDirection="Horizontal">
                            <asp:ListItem Value="a" onclick="">Activate</asp:ListItem>
                            <asp:ListItem Value="d">Deactivate</asp:ListItem>
                        </asp:RadioButtonList>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn Visible="False" DataField="Value" HeaderText="Sncode"></asp:BoundColumn>
            </Columns>
            <PagerStyle Font-Size="11px" Font-Names="Arial" HorizontalAlign="Right" ForeColor="White" BackColor="#A2547F"
                Mode="NumericPages"></PagerStyle>
        </asp:DataGrid>
        <asp:DataGrid ID="DataGrid1Temp" runat="server" Visible="false" Width="100%" AutoGenerateColumns="False">
            <FooterStyle Font-Size="11px" Font-Names="Arial" ForeColor="White" BackColor="#A2547F"></FooterStyle>
            <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#A2547F"></HeaderStyle>
            <Columns>
                <asp:TemplateColumn HeaderText="Servis">
                    <HeaderStyle Font-Size="11px" Font-Names="Arial" ForeColor="White" Width="10px"></HeaderStyle>
                    <ItemStyle Font-Size="11px" Font-Names="Arial" Wrap="False" BackColor="Lavender" Width="1000"></ItemStyle>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkSelect" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Text") %>' ToolTip='<%# DataBinder.Eval(Container.DataItem, "Value") %>'></asp:CheckBox>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="İşlem">
                    <HeaderStyle Font-Size="11px" Font-Names="Arial" ForeColor="White" Width="10px"></HeaderStyle>
                    <ItemStyle Font-Size="11px" Font-Names="Arial" Wrap="False" BackColor="Lavender" Width="200"></ItemStyle>
                    <ItemTemplate>
                        <asp:RadioButtonList ID="rlstProcessType" runat="server" SelectedValue="<%# DefaultProcessType %>" RepeatDirection="Horizontal">
                            <asp:ListItem Value="a" onclick="">Activate</asp:ListItem>
                            <asp:ListItem Value="d">Deactivate</asp:ListItem>
                        </asp:RadioButtonList>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn Visible="False" DataField="Value" HeaderText="Sncode"></asp:BoundColumn>
            </Columns>
            <PagerStyle Font-Size="11px" Font-Names="Arial" HorizontalAlign="Right" ForeColor="White" BackColor="#A2547F"
                Mode="NumericPages"></PagerStyle>
        </asp:DataGrid>

        <br>
        <cc1:ContentPaneFooter ID="ContentPaneFooter1Second" runat="server" Width="100%" CausesValidation="True" Text="Gönder"
            CssClass="nav" Height="25px" CellPadding="0" CellSpacing="0" ConfirmText="Gönder" NavigateBackText="Geri"
            ButtonsCssClass="button01" NavigateBackClientFunction="javascript:history.back();">
        </cc1:ContentPaneFooter>
    </form>
    <script type="text/javascript" language="javascript">
        function OnCheckboxClick(checkbox) {
            var sncode = checkbox.parentElement.title;

            //alert( checkbox.parentElement.parentElement.parentElement.cells[1].all[0].rows[0].cells[1].all[0].checked);
            var sss = checkbox.parentElement.parentElement.parentElement.cells[1].all[0].rows[0].cells[1].all[0].checked;
            //alert(sss);



            if (sncode == '63') {
                setServiceStatus('64', checkbox.checked && checkbox.parentElement.parentElement.parentElement.cells[1].all[0].rows[0].cells[1].all[0].checked);
                setServiceStatus('65', checkbox.checked && checkbox.parentElement.parentElement.parentElement.cells[1].all[0].rows[0].cells[1].all[0].checked);
            }

            if ((sncode == '37' && tumdunya == 'SINGLE') || (sncode == '40' && tumdunya == 'SINGLE')) {
                var row = checkbox.parentElement.parentElement.parentElement;


                if (checkbox.checked && sss == true) {
                    alert("Uyarı: Abonenin TümDünya Servisi Olduğundan Profil Uyumsuzluğu Vardır.!!!!");
                }
            }

            if ((sncode == '37' && tumdunya == 'NOTSINGLE') || (sncode == '40' && tumdunya == 'NOTSINGLE')) {
                var row = checkbox.parentElement.parentElement.parentElement;
                if (checkbox.checked && sss == true) {
                    alert("Uyarı: Toplu işlem listesinde bulunan Abonelerde TümDünya Servisi Olduğundan  Profil Uyumsuzluğu Vardır.!!!!");
                }
            }



            if ((sncode == '123' && tumdunya == 'SINGLE') || (sncode == '121' && tumdunya == 'SINGLE')) {
                var row = checkbox.parentElement.parentElement.parentElement;


                if (checkbox.checked && sss == true) {
                    alert("Uyarı: Abonenin TümDünya Servisi Olduğundan Profil Uyumsuzluğu Vardır.!!!!");
                }
            }
            if ((sncode == '121' && tumdunya == 'NOTSINGLE') || (sncode == '123' && tumdunya == 'NOTSINGLE')) {
                var row = checkbox.parentElement.parentElement.parentElement;
                if (checkbox.checked && sss == true) {
                    alert("Uyarı: Toplu işlem listesinde bulunan Abonelerde TümDünya Servisi Olduğundan  Profil Uyumsuzluğu Vardır.!!!!");
                }
            }







            if (sncode == '5') {
                var row = checkbox.parentElement.parentElement.parentElement;
                setServiceStatus('6', checkbox.checked && row.cells[1].all[0].rows[0].cells[1].all[0].checked);
            }

            if (sncode == '6') {
                var row = checkbox.parentElement.parentElement.parentElement;
                setServiceStatus('5', checkbox.checked && row.cells[1].all[0].rows[0].cells[0].all[0].checked);
            }

            checkForSingleSelection(checkbox.parentElement.parentElement.parentElement);
        }

        function OnRadioClick(radio) {
            var row = radio.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
            var sncode = row.cells[0].all[0].title;
            var checkbox = row.cells[0].all[0].all[0];
            if (sncode == '5')
                setServiceStatus('6', checkbox.checked && row.cells[1].all[0].rows[0].cells[1].all[0].checked);
            else if (sncode == '6')
                setServiceStatus('5', checkbox.checked && row.cells[1].all[0].rows[0].cells[0].all[0].checked);
            else if (sncode == '63') {
                setServiceStatus('64', checkbox.checked && checkbox.parentElement.parentElement.parentElement.cells[1].all[0].rows[0].cells[1].all[0].checked);
                setServiceStatus('65', checkbox.checked && checkbox.parentElement.parentElement.parentElement.cells[1].all[0].rows[0].cells[1].all[0].checked);
            }

            //checkForSingleSelection(row);
        }

        function setServiceStatus(sncode, oppositeSlected) {
            var inputs = document.getElementsByTagName('input');
            var inputIndex = 0;
            for (inputIndex = 0; inputIndex < inputs.length; inputIndex++) {
                if (inputs[inputIndex].type == 'checkbox' && inputs[inputIndex].parentElement.title == sncode) {
                    inputs[inputIndex].disabled = oppositeSlected;
                    inputs[inputIndex].checked = (!inputs[inputIndex].disabled) && inputs[inputIndex].checked;
                }
            }
        }

        function checkForSingleSelection(modifingServiceRow) {
            if (forceToSingleSelection == true) {
                var modifingServiceSelection = modifingServiceRow.cells[0].all[0].all[0];
                var modifingServiceActivationRadio = modifingServiceRow.cells[1].all[0].rows[0].cells[0].all[0];;
                var modifingServiceDeactivationRadio = modifingServiceRow.cells[1].all[0].rows[0].cells[1].all[0];;
                var servicesTable = modifingServiceRow.parentElement;
                var rowIndex = 0;
                var serviceRow;
                var selectionCheckBox;
                var activationRadio;
                var deactivationRadio;
                for (rowIndex = 1; rowIndex < servicesTable.rows.length; rowIndex++) {
                    serviceRow = servicesTable.rows[rowIndex];
                    selectionCheckBox = serviceRow.cells[0].all[0].all[0];
                    activationRadio = serviceRow.cells[1].all[0].rows[0].cells[0].all[0];
                    deactivationRadio = serviceRow.cells[1].all[0].rows[0].cells[1].all[0];

                    selectionCheckBox.checked = selectionCheckBox.checked && serviceRow == modifingServiceRow;
                    selectionCheckBox.disabled = serviceRow != modifingServiceRow && modifingServiceSelection.checked;
                    activationRadio.disabled = selectionCheckBox.disabled;
                    deactivationRadio.disabled = selectionCheckBox.disabled;
                    /*
                    if (serviceRow != modifingServiceRow && modifingServiceSelection.checked && selectionCheckBox.checked && modifingServiceActivationRadio.checked)
                    {
                        activationRadio = serviceRow.cells[1].all[0].rows[0].cells[0].all[0];
                        deactivationRadio = serviceRow.cells[1].all[0].rows[0].cells[1].all[0];
                        activationRadio.checked = modifingServiceSelection.checked && !modifingServiceActivationRadio.checked;
                        deactivationRadio.checked = modifingServiceSelection.checked && modifingServiceActivationRadio.checked;
                    }
                    */
                }
            }
        }

        var inputs = document.getElementsByTagName('input')
        var inputIndex = 0;
        for (inputIndex = 0; inputIndex < inputs.length; inputIndex++)
            if (inputs[inputIndex].type == 'radio') {
                inputs[inputIndex].onclick = function () { OnRadioClick(this) };
            }


    </script>
</body>
</html>

